<!--
 * @Author: 龚燎原 274473435@qq.com
 * @Date: 2023-12-09 15:43:41
 * @LastEditors: 龚燎原
 * @LastEditTime: 2023-12-10 15:23:35
-->
<template>
    <el-dialog :title="title" :visible.sync="dialogVisible" width="500px" append-to-body>
        <el-form ref="form" :model="form" :rules="rules" label-width="130px">
            <el-form-item label="客户指定到站时间" prop="customSpecArriveTime">
                <el-date-picker clearable v-model="form.customSpecArriveTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"
                    placeholder="请选择客户指定到站时间">
                </el-date-picker>
            </el-form-item>
            <el-form-item label="母站出发时间" prop="goTime">
                <el-date-picker clearable v-model="form.goTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"
                    placeholder="请选择母站出发时间">
                </el-date-picker>
            </el-form-item>
            <el-form-item label="始发地" prop="departAddr">
                <el-input v-model="form.departAddr" placeholder="请输入始发地" />
            </el-form-item>
            <el-form-item label="目的地" prop="arriveAddr">
                <el-input v-model="form.arriveAddr" placeholder="请输入目的地" />
            </el-form-item>
            <el-form-item label="距离" prop="distance">
                <el-input v-model="form.distance" placeholder="请输入距离" />
            </el-form-item>
            <el-row type="flex" justify="end">
                <el-button type="primary" @click="submitForm">提交</el-button>
                <el-button @click="cancel">取消</el-button>
            </el-row>
        </el-form>
    </el-dialog>
</template>
    
<script>

export default {
    name: "ExtSale",
    data() {
        return {
            dialogVisible: false,
            title: '',
            // 表单参数
            form: {},
            // 表单校验
            rules: {
            }
        };
    },
    created() {

    },
    methods: {
        open(data) {
            this.form = Object.assign({}, data)
            this.title = "调度信息"
            this.dialogVisible = true
        },
        // 取消按钮
        cancel() {
            this.reset();
            this.dialogVisible = false
            // this.$emit("cancel")
        },
        // 表单重置
        reset() {
            this.form = {};
            this.resetForm("form");
        },
        /** 提交按钮 */
        submitForm() {
            this.$refs["form"].validate(valid => {
                if (valid) {
                    const {saleRecordId, customSpecArriveTime, goTime, departAddr, arriveAddr, distance } = this.form
                    this.$emit('submit', { saleRecordId,customSpecArriveTime, goTime, departAddr, arriveAddr, distance })
                }
            });
        }
    }
};
</script>
    